﻿@{
    var permissionCount = Session["_UserPermission"] != null ? int.Parse(Session["_UserPermission"].ToString()) : 0;
}

<script type="text/javascript">
    var _intPermission = @permissionCount;

    function checkPriviledge(curentpermission, href) {
        showLoading();
        var isPermission = true;
        if (_intPermission < curentpermission)
            isPermission = false;

//        $.ajax({
//            type: 'GET',
//            url: '/Admin/CheckPermission',
//            data: { pageName: pageName },
//            async: false,
//            cache: false,
//            dataType: 'json',
//            success: function (data) {
//                isPermission = data;
//            },
//            error: function (e) {
//                alert(e.message);
//            }
//        });

        if (!isPermission) {
            $(".divContent").empty();
            $(".divContent").append('<span id="h2permission">Bạn không có Quyền truy cập trang này !</span>');
            hideLoading();
        }
        else
            window.location = href;

        return isPermission;
    }
</script>



<div>
    <ul class="ulMenuMain">
        <li><a href='#' onclick="return checkPriviledge(3,'/menu/ManagerMenu');">Menu</a></li>
        <li><a href='#' onclick="return checkPriviledge(1,'/admin/user_list');">User</a></li>
        <li><a href="#" onclick="return checkPriviledge(3,'/CatLand/CatLandList');">Nhóm</a></li>
        <li><a href="#" onclick="return checkPriviledge(3,'/Building/Index');">Dự Án</a></li>
        @*<li><a href='/Building/Index' onclick='return checkPriviledge("Building");'>Bài viết</a></li>*@
        <li><a href="#" onclick="return checkPriviledge(1,'/Building/ManagerNews');">Tin tức</a></li>        
        <li><a href="#" onclick="return checkPriviledge(1,'/proland/AD_LandList');">SGD Kim Thành</a></li>
        <li><a href="#" onclick="return checkPriviledge(1,'/CusLand/AD_CusLandList');">SGD BĐS</a></li>
        <li><a href="#" onclick="return checkPriviledge(3,'/Event/Index');">Sự Kiện</a></li>
    </ul>
</div>
@*<div>
    <ul class="ulMenuMain">
        <li><a href="/Building/openEdit?id=6475523f-b855-4fc3-960a-9e808c9ef496&dt=1415967210330">Bài viết</a></li>
    </ul>
</div>*@